package com.bw.mine.login.viewmodel

import android.util.Log
import com.blankj.utilcode.util.ToastUtils
import com.bw.common.http.NetUtils.httpRequest
import com.bw.mine.login.entiity.LoginEntity
import javax.inject.Inject

class LoginRepo @Inject constructor(val loginApiService: LoginApiService){
    suspend fun getLogin(password:String,username:String):LoginEntity?{
        val result = httpRequest{loginApiService.getLogin(password, username)}
        if (result.code == 200) {
            return result.data
        }else{
            Log.d("错误打印", "getLogin: aaaaaa")
            ToastUtils.showLong(result.message)
        }
        return null
    }

    suspend fun getRequest(password:String,username:String):LoginEntity?{
        val result = httpRequest{loginApiService.getRegister(password, username)}
        if (result.code == 200) {
            return result.data
        }
        return null
    }
}